<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>王者荣耀竞猜管理平台</title>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/jquery-easyui-1.5.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/jquery-easyui-1.5.3/themes/icon.css">
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/jquery-easyui-1.5.3/jquery.min.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
    <style>
        .menu-second {
            display: block;

        }
        .menu-first a:hover {
            cursor: pointer;
            color: #00bbee;
        }
    </style>
</head>
<body class="easyui-layout">
<div data-options="region:'north',border:true" style="height:10%;background:#B3DFDA; text-align: center;background: url('../image/banner.jpg')">
    <h1>王者荣耀竞猜管理平台</h1>
</div>
<div data-options="region:'west',split:true,title:'功能菜单'" style="width:260px">
    <div class="easyui-accordion" style="width:88%;height:98%;" data-options="fit:'false'">
        <c:forEach items="${menus}" var="m1">
            <div class="menu-first" align="center" title="${m1.name}" data-options="iconCls:'${m1.icon}'"
                 style="width: 100%;border-color: #ffffff">
                <c:forEach items="${m1.children}" var="m">
                    <a class="menu-second"
                       onclick="addTab('${m.name}','${pageContext.request.contextPath}/admin/${m.url}')">${m.name}</a>
                    <hr>
                </c:forEach>
            </div>
        </c:forEach>
    </div>
</div>
<div data-options="region:'center',title:'功能区',tools: [{iconCls:'icon-redo',handler:function(){loginout();}}]" class="easyui-tabs" id="tt">
    <div title="欢迎页" align="center">
        <h1>欢迎来到王者荣耀竞猜管理平台</h1>
    </div>
</div>
</body>
<script>
    function addTab(title, url) {
        if ($('#tt').tabs('exists', title)) {
            $('#tt').tabs('select', title);
        } else {
            var content = '<iframe scrolling="no" frameborder="0"  src="' + url + '" style="width:100%;height:99%;"></iframe>';
            $('#tt').tabs('add', {
                title: title,
                content: content,
                closable: true
            });
        }
    }
    function loginout() {
        $.post('/sysUser/loginOut', function (data) {
            if (data.code == '0') {
                window.location.reload();
            } else {
                $.messager.alert("服务器繁忙！");
            }
        });
    }
</script>
</html>
